home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / DCLAP 6d / dclap6d / DClap / dgg.h < prev    next >
Text File  |  1996-07-05  |  3KB  |  147 lines

  1. /* dgg.h */
  2. /* dggilbert additions to ncbi tools*/
  3.  
  4. #ifndef _DGGADD_
  5. #define _DGGADD_
  6.  
  7. #include <ncbi.h>
  8.  
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12.  
  13. /* NOTE: ncbiwin.h has #undef true, #undef false to live w/ Type.h include that defines these */
  14.  
  15. #ifndef true
  16. #define true   1
  17. #endif
  18.  
  19. #ifndef false
  20. #define false  0
  21. #endif
  22.  
  23. #ifndef Global
  24. #define Global
  25. #endif 
  26.  
  27. #ifndef Local
  28. #define Local  static
  29. #endif 
  30.  
  31. /* d*mn 16bit mswin/borc defines size_t as 16bit uint ! I've been using it as ulong ! */ 
  32. #define ulong  unsigned long
  33. /* ?? or is a typdef preferred ??:  typedef        unsigned long     ulong; */
  34.  
  35. #ifndef Max
  36. #define Max    MAX
  37. #endif
  38.  
  39. #ifndef Min
  40. #define Min    MIN
  41. #endif
  42.  
  43. #ifndef MinMax
  44. #define MinMax(xmin,x,xmax) ((x>xmax) ? (xmax) : ((x<xmin) ? (xmin) : (x)))   
  45. #endif
  46.  
  47. #ifndef odd
  48. #define odd(x) ((x) & 0x00000001)
  49. #endif
  50.  
  51. #ifndef is_upper
  52. #define is_upper(c)    ('A'<=(c) && (c)<='Z')
  53. #endif
  54.  
  55. #ifndef is_lower
  56. #define is_lower(c)    ('a'<=(c) && (c)<='z')
  57. #endif
  58.  
  59. #ifndef to_lower
  60. #define to_lower(c)    ((char)(is_upper(c) ? (c)+' ' : (c)))
  61. #endif
  62.  
  63. #ifndef to_upper
  64. #define to_upper(c)    ((char)(is_lower(c) ? (c)-' ' : (c)))
  65. #endif
  66.  
  67. #ifdef WIN_MOTIF
  68. #define xdebug(x)   fprintf(stderr,"%s\n", x)
  69. #define xdebugp(fmt,p) fprintf(stderr,fmt,p)
  70. #else
  71. #define xdebug(x)
  72. #define xdebugp(fmt,p)
  73. #endif
  74.  
  75.     /* deal w/ line termination variation among op systems */
  76. extern char*    LineEnd;
  77. extern short  LineEndSize;
  78.  
  79.     /* and do it as constants rather than a variable... */
  80.     /* p.s., looks like we can assume LineEndSize == 1 always, mswin seems happy w/ LF only */
  81. #ifdef WIN_MAC
  82. #define LINEEND    "\015"
  83. #define NEWLINE '\015'
  84. #else
  85. #define LINEEND "\012"
  86. #define NEWLINE '\012'
  87. #endif
  88.  
  89.     /* to bypass compilers that do strange things to "\r\n" */
  90. #ifndef CRLF
  91. #define CRLF    "\015\012"
  92. #endif
  93.  
  94.  
  95. #define StrDup    Nlm_StringSave    
  96. #define Strcasecmp Nlm_StringICmp
  97. #define Strncasecmp Nlm_StringNICmp
  98.  
  99. Nlm_CharPtr LIBCALL Dgg_StrExtendCat PROTO(( Nlm_CharPtr *dest, char *src));
  100. #define StrExtendCat    Dgg_StrExtendCat    
  101.  
  102. Nlm_CharPtr LIBCALL Dgg_StrPrependCat PROTO(( Nlm_CharPtr *dest, char *src));
  103. #define StrPrependCat    Dgg_StrPrependCat    
  104.  
  105. Nlm_CharPtr LIBCALL Dgg_MemExtendCat PROTO(( Nlm_CharPtr *dest, long dlen, char *src, long slen));
  106. #define MemExtendCat    Dgg_MemExtendCat    
  107.  
  108. Nlm_CharPtr LIBCALL  Dgg_StrAppend PROTO((char *to, char *from));
  109. #define StrAppend    Dgg_StrAppend    
  110.  
  111. long LIBCALL Dgg_Str2Idtype PROTO(( char *s));
  112. #define Str2Idtype    Dgg_Str2Idtype    
  113.  
  114. const Nlm_CharPtr LIBCALL Dgg_Idtype2Str PROTO(( long id));
  115. #define Idtype2Str    Dgg_Idtype2Str    
  116.  
  117. void Dgg_StrUpcase PROTO(( char *s));
  118. #define StrUpcase    Dgg_StrUpcase    
  119.  
  120. void Dgg_StrLocase PROTO(( char *s));
  121. #define StrLocase    Dgg_StrLocase    
  122.  
  123. extern Nlm_CharPtr* Dgg_ReadDefaultPrefs PROTO((FILE *fp, Nlm_Int2* nlines));
  124. #define ReadDefaultPrefs    Dgg_ReadDefaultPrefs    
  125.  
  126.     /* gcc/sun linker has problems finding Nlm_ version of these */
  127. void Dgg_IntToStr PROTO((Nlm_Int2 intval, Nlm_CharPtr str, Nlm_Int2 length, ulong maxsize));
  128.  
  129. void Dgg_LongToStr PROTO((Nlm_Int4 longval, Nlm_CharPtr str,  Nlm_Int2 length, ulong maxsize));
  130.  
  131.  
  132. #ifdef OS_MAC
  133. pascal    short    DetermineVRefNum( char* pathname, short vRefNum, short *realVRefNum);
  134. pascal    short    GetDirID( short vRefNum, long dirID, char* name, long *theDirID, 
  135.                                                     Boolean *isDirectory);
  136. extern void Nlm_PtoCstr (Nlm_CharPtr str); // in vibutils.c
  137. extern void Nlm_CtoPstr (Nlm_CharPtr str); // in vibutils.c
  138. #endif
  139.  
  140.  
  141. #ifdef __cplusplus
  142. }
  143. #endif
  144.  
  145.  
  146. #endif
  147.